<template>
	<view>
		<view class="card">
			<image :src="mixiImgUrl + '/static/img_yue.png'" mode="" class="card-bg"></image>
			<view class="card-c flex-center">
				<view class="card-c-title">账户余额（元）</view>
				<view class="card-c-price">{{userInfo.balance || 0}}</view>
				<view class="card-c-tx">可提现金额（元）{{userInfo.balance || 0}}</view>
			</view>
			<view class="mx flex-center">提现明细</view>
			<view class="lj flex-center">
				<view class="lj-title">累计提现</view>
				<view class="lj-price">￥0</view>
			</view>
		</view>
		<view class="line"></view>
		<view class="content">
			<view class="title">提现金额</view>
			<view class="flex-sp">
				<view class="flex-sp-price">
					￥
					<input type="number"  placeholder-class="ac" v-model="price"/>
				</view>
				<view class="flex-sp-btn" @click="setPrice">全部提现</view>
			</view>
			<view class="flex-sp">
				<view class="flex-sp-tx">结算账户</view>
				<view class="flex-sp-tx">支付宝1 45656@qq.com</view>
			</view>
			<view class="tx">
				<view>1.税费说明:提现时平台代扣 <text>8%</text>税费<text>+2</text>元/笔服务费; . </view>
				<view>2.日结说明:收益实时计算，实时入账，提现<text>12小时</text>内到账;</view>
			</view>
		</view>
		<view class="btns flex-center" @click="submit">确认提现</view>
	</view>
</template>

<script>
	import {
		withdrawHttp
	} from '@/common/http/api.js'
	export default {
		data(){
			return {
				price: 0
			}
		},
		computed: {
			userInfo() {
				return this.$store.state.userInfo
			}
		},
		onShow() {
			this.$store.dispatch('getUserInfo')
		},
		methods:{
			setPrice(){
				this.price = this.userInfo.balance || 0
			},
			submit(){
				if(this.price === 0 || this.price === '') {
					uni.showToast({
						title:"请输入提现金额！",
						icon: 'none'
					})
					return
				}
				uni.showLoading()
				withdrawHttp({money: this.price}).then(res => {
					uni.hideLoading()
					uni.showToast({
						title: "提交成功！",
						icon: 'none'
					})
					this.$store.dispatch('getUserInfo')
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background: #F6F1E7;
	}
	.card {
		width: 724rpx;
		height: 342rpx;
		position: relative;
		.card-c {
			width: 100%;
			position: absolute;
			left: 0;
			top: 0;
			height: 100%;
			box-sizing: border-box;
			padding: 47rpx 39rpx 32rpx;
			flex-direction: column;
			justify-content: space-between;
			align-items: flex-start;
			.card-c-title {
				font-family: Source Han Sans CN;
				font-weight: 400;
				font-size: 32rpx;
				color: #804809;
			}
			.card-c-price {
				font-family: Source Han Sans CN;
				font-weight: bold;
				font-size: 79rpx;
				color: #804809;
			}
			.card-c-tx {
				font-family: Source Han Sans CN;
				font-weight: 400;
				font-size: 24rpx;
				color: #804809;
			}
			
		}
		.mx {
			width: 127rpx;
			height: 40rpx;
			background: #FFE2C6;
			box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(255,54,107,0.2);
			border-radius: 0rpx 16rpx 0rpx 16rpx;
			font-family: Source Han Sans CN;
			font-weight: 400;
			font-size: 20rpx;
			color: #804809;
			position: absolute;
			right: 0;
			top: 0;
			z-index: 2;
		}
		.lj {
			position: absolute;
			right: 32rpx;
			bottom: 34rpx;
			z-index: 2;
			flex-direction: column;
			.lj-title {
				font-family: Source Han Sans CN;
				font-weight: 400;
				font-size: 24rpx;
				color: #804809;
				margin-bottom: 15rpx;
			}
			.lj-price {
				font-family: Source Han Sans CN;
				font-weight: 400;
				font-size: 24rpx;
				color: #804809;
			}
		}
	}
	.line {
		width: 100%;
		height: 16rpx;
		background: #EFE9DD;
		margin: 42rpx 0 29rpx;
	}
	.content {
		width: 100%;
		box-sizing: border-box;
		padding: 0 31rpx;
		.title {
			font-family: Source Han Sans CN;
			font-weight: 500;
			font-size: 36rpx;
			color: #333333;
			margin-bottom: 48rpx;
		}
		.flex-sp {
			margin-bottom: 76rpx;
			.flex-sp-price {
				width: 300rpx;
				font-family: PingFang SC;
				font-weight: bold;
				font-size: 48rpx;
				color: #333333;
				display: flex;
				align-items: center;
				input {
					font-family: PingFang SC;
					font-weight: bold;
					font-size: 48rpx;
					color: #333333;
					flex: 1;
				}
				.ac {
					font-family: PingFang SC;
					font-weight: bold;
					font-size: 48rpx;
					color: #333333;
				}
			}
			.flex-sp-btn {
				font-family: Source Han Sans CN;
				font-weight: 500;
				font-size: 28rpx;
				color: #804809;
			}
			.flex-sp-tx {
				font-family: Source Han Sans CN;
				font-weight: 400;
				font-size: 30rpx;
				color: #666666;
			}
		}
		.tx {
			width: 100%;
			view {
				font-family: Source Han Sans CN;
				font-weight: 400;
				font-size: 24rpx;
				color: #666666;
				margin-bottom: 20rpx;
				text {
					color: #EA5513;
				}
			}
		}
	}
	.btns {
		width: 550rpx;
		height: 88rpx;
		background: #804809;
		border-radius: 16rpx;
		font-family: Source Han Sans CN;
		font-weight: 500;
		font-size: 30rpx;
		color: #FEFEFE;
		margin: 0 auto;
		margin-top: 140rpx;
	}
</style>